#!/usr/bin/perl -w

use strict;

my ($msg, $currentnick);
while (<>) {
	if (/^msg\s+(.*)/) {
		$msg = $1;
	}
	elsif (/^currentnick\s+(\S+)/) {
		$currentnick = $1;
	}
}

if (defined $msg and defined $currentnick and
		$msg =~ /^$currentnick:?(.*\?)\s*$/) {
	print "msg !answer $1\n";
}
